#include <iostream>
#include <vector>
#include <set>
using namespace std;



int main() {
	vector<int> dx = { 2,2,1,1,-2,-2,-1,-1 };
	vector<int> dy = { 1,-1,2,-2,1,-1,2,-2 };
	int n = 7, m = 7, x = 3, y = 3;
	//cin >> n >> m >> x >> y;
	vector<vector<int>> dp(n + 1, vector<int>(m + 1));
	set<pair<int, int>> hash;

	hash.insert({ x + 1,y + 1 });
	for (int i = 0; i < 8; i++)
	{
		int a = x + dx[i] + 1, b = y + dy[i] + 1;
		hash.insert({ a,b });
	}

	dp[0][1] = 1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			if (!hash.count({ i,j }))
				dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
			//cout << dp[i][j] << " ";
		}
		//cout << endl;
	}
	cout << dp[n][m] << endl;

	for (int i = 0; i <= n; i++)
	{
		for (int j = 0; j <= m; j++)
		{
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}